<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 1、验证回文串

```
给你一个字符串 s，从中删除一个字符。

判断删除后的字符串 s 是否能成为回文字符串：如果能，返回 true ；否则，返回 false
 -->
</head>
<body>
  <script>
  var validPalindrome = function(s) {
    let sArr = s.split('');
    for (let i = 0; i <= (sArr.length >> 1); i++) {
        if (sArr[i] !== sArr[sArr.length - i - 1]) {
            let f = [...sArr];
            f.splice(i,1);
            let f2 = [...sArr]; 
            f2.splice(sArr.length - i - 1,1);
            if ((f+'') == ([...f].reverse()+'') || (f2 + '') == ([...f2].reverse() + '')) {
                return true
            } else {
                return false
            }
        }
    }
    return true
  };
console.log(validPalindrome('abcbdasdasadasdsadsaa'));
  </script>
</body>
</html>